<template>
  <div class="details">
    <div id="tu">
      <!-- <p>—— 分享 ——</p> -->
      <!-- <img id="img1" src="/weibo.png" alt=""> -->
      <!-- <img id="img2" src="/weixin.png" alt=""> -->
    </div>
    <div id="add">
      <div id="tou">
        <router-link to="/news" class="n">首页</router-link>
        <i class="el-icon-arrow-right"></i>
        <a href="" class="n">零食</a>
        <i class="el-icon-arrow-right"></i>
        <a href="" class="n">正文</a>
      </div>
      <template v-if="data">
        <div v-for="item in data.results" :key="item">
          <div id="biaoti">
            <h1 align="left">{{ item.ntitle }}</h1>
            <div>
              <p align="left">作者:互联网浆糊</p>
              <p align="left">文章来源:互联网浆糊</p>
            </div>
          </div>

          <div class="box">
            <p align="left">{{ item.content }}</p>
          </div>
        </div></template
      >
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    getData() {
      const nid = this.$route.query.nid;
      console.log(nid);
      const url = "http://localhost:3000/wenzhang?nid=" + nid;
      this.axios.get(url).then((res) => {
        console.log("res", res);
        this.data = res.data;
      });
    },
  },
  mounted() {
    this.getData();
  },
  data() {
    return {
      data: null,
    };
  },
};
</script>

<style lang="scss" scoped src='../assets/css/wenzhang.scss'>
</style>